package com.jcfy.project.module.service.impl;

import java.util.List;
import com.jcfy.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.jcfy.project.module.mapper.TAccountMapper;
import com.jcfy.project.module.domain.TAccount;
import com.jcfy.project.module.service.ITAccountService;

/**
 * 账户Service业务层处理
 *
 * @author jiangfeng
 * @date 2020-08-05
 */
@Service
public class TAccountServiceImpl implements ITAccountService {
    @Autowired
    private TAccountMapper tAccountMapper;

    /**
     * 查询账户
     *
     * @param accountId 账户ID
     * @return 账户
     */
    @Override
    public TAccount selectTAccountById(Long accountId) {
        return tAccountMapper.selectTAccountById(accountId);
    }

    /**
     * 查询账户列表
     *
     * @param tAccount 账户
     * @return 账户
     */
    @Override
    public List<TAccount> selectTAccountList(TAccount tAccount) {
        return tAccountMapper.selectTAccountList(tAccount);
    }

    /**
     * 新增账户
     *
     * @param tAccount 账户
     * @return 结果
     */
    @Override
    public int insertTAccount(TAccount tAccount) {
        tAccount.setCreateTime(DateUtils.getNowDate());
        return tAccountMapper.insertTAccount(tAccount);
    }

    /**
     * 修改账户
     *
     * @param tAccount 账户
     * @return 结果
     */
    @Override
    public int updateTAccount(TAccount tAccount) {
        tAccount.setUpdateTime(DateUtils.getNowDate());
        return tAccountMapper.updateTAccount(tAccount);
    }

    /**
     * 批量删除账户
     *
     * @param accountIds 需要删除的账户ID
     * @return 结果
     */
    @Override
    public int deleteTAccountByIds(Long[] accountIds) {
        return tAccountMapper.deleteTAccountByIds(accountIds);
    }

    /**
     * 删除账户信息
     *
     * @param accountId 账户ID
     * @return 结果
     */
    @Override
    public int deleteTAccountById(Long accountId) {
        return tAccountMapper.deleteTAccountById(accountId);
    }
}
